package com.alm.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author ywy
 * @date 2024/7/4
 */
@Getter
@AllArgsConstructor
public enum ChangeModeEnum {

    /**
     * 实时
     */
    REALTIME("REALTIME", 18, "实时"),

    /**
     * 定时
     */
    REGULAR("REGULAR", 21, "定时");


    private String code;

    /**(
     * alm_dev_command表id
     */
    private Integer commandId;

    private String value;


    /**
     * 根据code获取commandId
     * @param code
     * @return
     */
    public static Integer getCommandIdByCode(String code) {
        for (ChangeModeEnum modeEnum : ChangeModeEnum.values()) {
            if(modeEnum.getCode().equals(code)) {
                return modeEnum.getCommandId();
            }
        }

        return -1;
    }
}
